<?php namespace Home\Controller; 
use Think\Controller; 
class UsersController extends CommonController
{     
	public function index(){
		$uid=$_SESSION['id'];
		$sql="select count(id) as count from question where uid='{$uid}'";

		$res=M('question')->query($sql);
		$res=current($res)['count'];
		$this->assign('w_num',$res);


		$Page = new \Think\Page($res,10);
		$show = $Page->show();
		$this->assign('page',$show);

		$sqls="select * from question where uid='{$uid}' limit ".$Page->firstRow.",".$Page->listRows;
		$res=M('question')->query($sqls);
		$this->assign('mywen',$res);

		$sql="select estate from user where id='{$uid}'";
		$res =current(M('user')->query($sql));

		$this->assign('email',$res);




		//我的收藏
		$csql="select count(*) as c_num from store where uid='{$uid}'";
		$cres=M('store')->query($csql);
		$cres=current($cres)['c_num'];
		$Page = new \Think\Page($cres,10);
		$show = $Page->show();
		$this->assign('cpage',$show);

		$csql="select t1.create_time, t2.title,t2.id from store t1 inner join question t2 on t1.qid=t2.id where t1.uid='{$uid}'limit ".$Page->firstRow.",".$Page->listRows;
		$cres=M()->query($csql);

		$this->assign('store',$cres);


		$this->display();

	}


}
?>